package demo4;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-09-06
 * Time: 9:36
 */
public class Dog {
    public String name;
    public int age;

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dog tmp = (Dog) o;
        return this.name.equals(tmp.name) && this.age == tmp.age;
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }
}
